#ifndef WSSERVER_DEF
#define WSSERVER_DEF

#include <winsock.h>
#include <vector>
#include "WSClient.h"
#pragma comment (lib, "Ws2_32.lib")

class WSServer
{	
    int m_Port;
    typedef std::vector<WSClient *> WSClientList;
    typedef std::vector<WSClient::IDataReceiver *> WSReceiversList;
    WSClientList m_RemoteClients;
    WSReceiversList m_DataReceivers;

    volatile SOCKET m_ListenSocket;
    volatile BOOL m_bCanListen;
    HANDLE m_hThread;
    static void ThreadFunc(LPVOID p);
public:
    WSServer(int port);
    virtual ~WSServer();
	void SetDataReceiver(WSClient::IDataReceiver *obj);
    void Send(char* buffer);
    void Send(void* buffer, int len);
};
#endif